Large and boring search and replace to remove structs that had only
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 23 Oct 2003 06:10:57 +0000 (06:10 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 23 Oct 2003 06:10:57 +0000 (06:10 +0000)
one member.  wpt->position.altitude.altitude_meters becomes wpt->altitude,
for example.

34 files changed:
gpsbabel/Makefile
gpsbabel/arcdist.c
gpsbabel/cetus.c
gpsbabel/copilot.c
gpsbabel/csv_util.c
gpsbabel/defs.h
gpsbabel/duplicate.c
gpsbabel/easygps.c
gpsbabel/garmin.c
gpsbabel/gcdb.c
gpsbabel/geo.c
gpsbabel/gpilots.c
gpsbabel/gpsdrive.c
gpsbabel/gpspilot.c
gpsbabel/gpsutil.c
gpsbabel/gpx.c
gpsbabel/holux.c
gpsbabel/magnav.c
gpsbabel/mapopolis.c
gpsbabel/mapsend.c
gpsbabel/mapsource.c
gpsbabel/navicache.c
gpsbabel/pcx.c
gpsbabel/polygon.c
gpsbabel/position.c
gpsbabel/psitrex.c
gpsbabel/psp.c
gpsbabel/quovadis.c
gpsbabel/saroute.c
gpsbabel/tiger.c
gpsbabel/tmpro.c
gpsbabel/tpg.c
gpsbabel/util.c
gpsbabel/waypt.c

index 35abf74e15ccbd635fe9f8889eb8558fdcdf910b..6907f8b103ddbaf52411debd23fa1ae8baab5a04 100644 (file)
@@ -116,13 +116,14 @@ navicache.o: navicache.c defs.h queue.h
 pcx.o: pcx.c defs.h queue.h garmin_tables.h
 polygon.o: polygon.c defs.h queue.h
 position.o: position.c defs.h queue.h
+psitrex.o: psitrex.c defs.h queue.h garmin_tables.h
 psp.o: psp.c defs.h queue.h
 queue.o: queue.c queue.h
 quovadis.o: quovadis.c quovadis.h defs.h queue.h coldsync/palm.h \
   coldsync/pdb.h
 route.o: route.c defs.h queue.h
 saroute.o: saroute.c defs.h queue.h
-tiger.o: tiger.c defs.h queue.h magellan.h csv_util.h
+tiger.o: tiger.c defs.h queue.h csv_util.h
 tmpro.o: tmpro.c defs.h queue.h csv_util.h
 tpg.o: tpg.c defs.h queue.h jeeps/gpsmath.h jeeps/gps.h jeeps/gpsport.h \
   jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
index 544072299c9d2eb8efd15a5382387d8a2694c16e..e4bf0e7f4706052cd3bc13b12e6ab2ba889a788a 100644 (file)
@@ -256,8 +256,8 @@ arcdist_process(void)
 
                waypointp = (waypoint *)elem;
                dist = linedist(lat1, lon1, lat2, lon2, 
-                               waypointp->position.latitude.degrees,
-                               waypointp->position.longitude.degrees );
+                               waypointp->latitude,
+                               waypointp->longitude );
 
                /* convert radians to float point statute miles */
                dist = (((dist * 180.0 * 60.0) / M_PI) * 1.1516);
index 9d9ebb374cea7b8ea7c5041212157c35d2d7ade4..94f6ef74ee94b809619c273e85072103b3103e4f 100644 (file)
@@ -159,14 +159,14 @@ data_read(void)
 
                rec = (struct record *) pdb_rec->data;
                if ( be_read32(&rec->elevation) == -100000000 ) {
-                       wpt_tmp->position.altitude.altitude_meters = unknown_alt;
+                       wpt_tmp->altitude = unknown_alt;
                }
                else {
-                       wpt_tmp->position.altitude.altitude_meters = be_read32(&rec->elevation) / 100.0;
+                       wpt_tmp->altitude = be_read32(&rec->elevation) / 100.0;
                }
                        
-               wpt_tmp->position.longitude.degrees = be_read32(&rec->longitude) / 10000000.0; 
-               wpt_tmp->position.latitude.degrees = be_read32(&rec->latitude) / 10000000.0;
+               wpt_tmp->longitude = be_read32(&rec->longitude) / 10000000.0; 
+               wpt_tmp->latitude = be_read32(&rec->latitude) / 10000000.0;
                        
                if (be_read16(&rec->year) != 0xff) {
                        struct tm tm;
@@ -225,13 +225,13 @@ cetus_writewpt(waypoint *wpt)
                be_write16(&rec->year, 0xff);
        }
 
-       be_write32(&rec->longitude, wpt->position.longitude.degrees * 10000000.0);
-       be_write32(&rec->latitude, wpt->position.latitude.degrees * 10000000.0);
-       if ( wpt->position.altitude.altitude_meters == unknown_alt ) {
+       be_write32(&rec->longitude, wpt->longitude * 10000000.0);
+       be_write32(&rec->latitude, wpt->latitude * 10000000.0);
+       if ( wpt->altitude == unknown_alt ) {
                be_write32(&rec->elevation, -100000000U);
        }
        else {
-               be_write32(&rec->elevation, wpt->position.altitude.altitude_meters * 100.0);
+               be_write32(&rec->elevation, wpt->altitude * 100.0);
        }
        
        be_write16( &rec->pdop, 0xffff );
index 7a15bdb0e398f91d52cb94b99c66959a8981fbb2..5bba68a986e286a86dcd70595e008f213430765c 100644 (file)
@@ -101,11 +101,11 @@ data_read(void)
                wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
 
                rec = (struct record *) pdb_rec->data;
-               wpt_tmp->position.longitude.degrees =
+               wpt_tmp->longitude =
                  -pdb_read_double(&rec->longitude) * conv;
-               wpt_tmp->position.latitude.degrees =
+               wpt_tmp->latitude =
                  pdb_read_double(&rec->latitude) * conv;
-               wpt_tmp->position.altitude.altitude_meters =
+               wpt_tmp->altitude =
                  pdb_read_double(&rec->elevation) * .3048;
 
                vdata = (char *) pdb_rec->data + sizeof(*rec);
@@ -134,11 +134,11 @@ copilot_writewpt(const waypoint *wpt)
 
        rec = xcalloc(sizeof(*rec)+1141,1);
 
-       pdb_write_double(&rec->latitude, wpt->position.latitude.degrees / conv);
+       pdb_write_double(&rec->latitude, wpt->latitude / conv);
        pdb_write_double(&rec->longitude,
-               -wpt->position.longitude.degrees / conv);
+               -wpt->longitude / conv);
        pdb_write_double(&rec->elevation,
-               wpt->position.altitude.altitude_meters / .3048);
+               wpt->altitude / .3048);
        pdb_write_double(&rec->magvar, 0);
 
        vdata = (char *)rec + sizeof(*rec);
index b87470b77b6be55f75eb01fd904733ebeabbaae2..45e11d2e1b265e2506d9d6377ce279145cfd6e39 100644 (file)
@@ -427,30 +427,30 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
     /* LATITUDE CONVERSIONS**************************************************/
     if (strcmp(fmp->key, "LAT_DECIMAL") == 0) {
        /* latitude as a pure decimal value */
-       wpt->position.latitude.degrees = atof(s);
+       wpt->latitude = atof(s);
     } else
     if ((strcmp(fmp->key, "LAT_DECIMALDIR") == 0) ||
         (strcmp(fmp->key, "LAT_DIRDECIMAL") == 0)) {
        /* latitude as a decimal with N/S in it. */
-       wpt->position.latitude.degrees = decdir_to_dec(s);
+       wpt->latitude = decdir_to_dec(s);
     } else
     if (strcmp(fmp->key, "LAT_INT32DEG") == 0) {
        /* latitude as a 32 bit integer offset */
-       wpt->position.latitude.degrees = intdeg_to_dec(atof(s), 1);
+       wpt->latitude = intdeg_to_dec(atof(s), 1);
     } else
     /* LONGITUDE CONVERSIONS ***********************************************/
     if (strcmp(fmp->key, "LON_DECIMAL") == 0) {
        /* longitude as a pure decimal value */
-       wpt->position.longitude.degrees = atof(s);
+       wpt->longitude = atof(s);
     } else
     if ((strcmp(fmp->key, "LON_DECIMALDIR") == 0) ||
         (strcmp(fmp->key, "LON_DIRDECIMAL") == 0)) {
        /* longitude as a decimal with N/S in it. */
-       wpt->position.longitude.degrees = decdir_to_dec(s);
+       wpt->longitude = decdir_to_dec(s);
     } else
     if (strcmp(fmp->key, "LON_INT32DEG") == 0) {
        /* longitude as a 32 bit integer offset  */
-       wpt->position.longitude.degrees = intdeg_to_dec(atof(s), 0);
+       wpt->longitude = intdeg_to_dec(atof(s), 0);
     } else
 
     /* DIRECTIONS **********************************************************/
@@ -464,11 +464,11 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
     /* ALTITUDE CONVERSIONS ************************************************/
     if (strcmp(fmp->key, "ALT_FEET") == 0) {
        /* altitude in feet as a decimal value */
-       wpt->position.altitude.altitude_meters = atof(s) * .3048;
+       wpt->altitude = atof(s) * .3048;
     } else
     if (strcmp(fmp->key, "ALT_METERS") == 0) {
        /* altitude in meters as a decimal value */
-       wpt->position.altitude.altitude_meters = atof(s);
+       wpt->altitude = atof(s);
     } else
 
     /* TIME CONVERSIONS ***************************************************/
@@ -691,70 +691,70 @@ xcsv_waypt_pr(const waypoint *wpt)
         /* LATITUDE CONVERSION***********************************************/
         if (strcmp(fmp->key, "LAT_DECIMAL") == 0) {
             /* latitude as a pure decimal value */
-            sprintf(buff, fmp->printfc, wpt->position.latitude.degrees);
+            sprintf(buff, fmp->printfc, wpt->latitude);
         } else
         if (strcmp(fmp->key, "LAT_DECIMALDIR") == 0) {
             /* latitude as a decimal value with N/S after it */
-            sprintf(buff, fmp->printfc, fabs(wpt->position.latitude.degrees), 
-              LAT_DIR(wpt->position.latitude.degrees));
+            sprintf(buff, fmp->printfc, fabs(wpt->latitude), 
+              LAT_DIR(wpt->latitude));
         } else
         if (strcmp(fmp->key, "LAT_DIRDECIMAL") == 0) {
             /* latitude as a decimal value with N/S before it */
             sprintf(buff, fmp->printfc, 
-              LAT_DIR(wpt->position.latitude.degrees),
-              fabs(wpt->position.latitude.degrees));
+              LAT_DIR(wpt->latitude),
+              fabs(wpt->latitude));
         } else
         if (strcmp(fmp->key, "LAT_INT32DEG") == 0) {
             /* latitude as an integer offset from 0 degrees */
             sprintf(buff, fmp->printfc,
-              dec_to_intdeg(wpt->position.latitude.degrees, 1));
+              dec_to_intdeg(wpt->latitude, 1));
         } else
 
         /* LONGITUDE CONVERSIONS*********************************************/
         if (strcmp(fmp->key, "LON_DECIMAL") == 0) {
             /* longitude as a pure decimal value */
-            sprintf(buff, fmp->printfc, wpt->position.longitude.degrees);
+            sprintf(buff, fmp->printfc, wpt->longitude);
         } else
         if (strcmp(fmp->key, "LON_DECIMALDIR") == 0) {
             /* latitude as a decimal value with N/S after it */
             sprintf(buff, fmp->printfc,
-              fabs(wpt->position.longitude.degrees), 
-              LON_DIR(wpt->position.longitude.degrees));
+              fabs(wpt->longitude), 
+              LON_DIR(wpt->longitude));
         } else
         if (strcmp(fmp->key, "LON_DIRDECIMAL") == 0) {
             /* latitude as a decimal value with N/S before it */
             sprintf(buff, fmp->printfc,
-              LON_DIR(wpt->position.longitude.degrees),
-              fabs(wpt->position.longitude.degrees));
+              LON_DIR(wpt->longitude),
+              fabs(wpt->longitude));
         } else
         if (strcmp(fmp->key, "LON_INT32DEG") == 0) {
             /* longitudee as an integer offset from 0 degrees */
             sprintf(buff, fmp->printfc,
-              dec_to_intdeg(wpt->position.longitude.degrees, 0));
+              dec_to_intdeg(wpt->longitude, 0));
         } else
 
         /* DIRECTIONS *******************************************************/
         if (strcmp(fmp->key, "LAT_DIR") == 0) {
             /* latitude N/S as a char */
             sprintf(buff, fmp->printfc,
-            LAT_DIR(wpt->position.latitude.degrees));
+            LAT_DIR(wpt->latitude));
         } else
         if (strcmp(fmp->key, "LON_DIR") == 0) {
             /* longitude E/W as a char */
             sprintf(buff, fmp->printfc,
-              LON_DIR(wpt->position.longitude.degrees));
+              LON_DIR(wpt->longitude));
         } else
 
         /* ALTITUDE CONVERSIONS**********************************************/
         if (strcmp(fmp->key, "ALT_FEET") == 0) {
             /* altitude in feet as a decimal value */
             sprintf(buff, fmp->printfc,
-              (wpt->position.altitude.altitude_meters * 3.2808));
+              (wpt->altitude * 3.2808));
         } else
         if (strcmp(fmp->key, "ALT_METERS") == 0) {
             /* altitude in meters as a decimal value */
             sprintf(buff, fmp->printfc,
-              wpt->position.altitude.altitude_meters);
+              wpt->altitude);
         } else
 
         /* TIME CONVERSIONS**************************************************/
index bed231345170dbc484678c301822b78f71a9621d..27a18276bfd4fec3ca007aa4a0dbb514f3169db7 100644 (file)
  */
 
 
-/*
- * A coordinate in space.
- */
-typedef struct {
-       double degrees;
-} coord;
-
-
-/*
- * An altitude is essentially a coordinate along only the Z axis.
- */
-
-typedef struct {
-       double altitude_meters;
-} altitude;
-
-
-/*
- * A triplet of the coordinates along the three axes describes
- * a position.
- */
-typedef struct {
-       coord latitude;
-       coord longitude;
-       altitude altitude;
-} position;
-
-
 /*
  * Define globally on which kind of data gpsbabel is working.
  * Important for "file types" that are essentially a communication
@@ -132,7 +104,10 @@ typedef struct xml_tag {
  */
 typedef struct {
        queue Q;
-       position position;
+
+       double latitude;                /* Degrees */
+       double longitude;               /* Degrees */
+       double altitude;                /* Meters. */
 
        /* 
         * The "thickness" of a waypoint; adds an element of 3D.  Can be
@@ -205,7 +180,7 @@ typedef void (*filter_init) (char const *);
 typedef void (*filter_process) (void);
 typedef void (*filter_deinit) (void);
 
-void fprintdms(FILE *, const coord *, int);
+// void fprintdms(FILE *, const coord *, int);
 
 typedef void (*waypt_cb) (const waypoint *);
 typedef void (*route_hdr)(const route_head *);
@@ -311,7 +286,7 @@ void warning(const char *, ...)
 ff_vecs_t *find_vec(char *, char **);
 void disp_vecs(void);
 void disp_formats(int version);
-void printposn(const coord *c, int is_lat);
+void printposn(float c, int is_lat);
 
 filter_vecs_t * find_filter_vec(char *, char **);
 void free_filter_vec(filter_vecs_t *);
index d575460dd4a4fd5afcf857a033da170114e33717..a7846e40bcc32275b14ee6d287bd52549cd07a67 100644 (file)
@@ -255,8 +255,8 @@ duplicate_process(void)
 
                if (lcopt) {
                        /* let sprintf take care of rounding */
-                       sprintf(dupe.lat, "%11.6f", waypointp->position.latitude.degrees);
-                       sprintf(dupe.lon, "%11.6f", waypointp->position.longitude.degrees);
+                       sprintf(dupe.lat, "%11.6f", waypointp->latitude);
+                       sprintf(dupe.lon, "%11.6f", waypointp->longitude);
                }
 
                crc = get_crc32(&dupe, sizeof(dupe));
index d7952e40da14b86ea45fdc4c248d52970f86fd54..85def632414682b3d6dcc89e0f60a18c3a926386 100644 (file)
@@ -163,12 +163,12 @@ data_read(void)
                        case 0x63:
                                fread(ibuf, 8, 1, file_in);
                                le_read64(&d, ibuf);
-                               wpt_tmp->position.latitude.degrees = d;
+                               wpt_tmp->latitude = d;
                                break;
                        case 0x64:
                                fread(ibuf, 8, 1, file_in);
                                le_read64(&d, ibuf);
-                               wpt_tmp->position.longitude.degrees = d;
+                               wpt_tmp->longitude = d;
                                break;
                        case 0x65:
                        case 0x66:
@@ -225,10 +225,10 @@ ez_disp(const waypoint *wpt)
                write_pstring(wpt->icon_descr);
        }
        fputc(0x63, file_out);
-       le_read64(tbuf, &wpt->position.latitude.degrees);
+       le_read64(tbuf, &wpt->latitude);
        fwrite(tbuf, 8, 1, file_out);
        fputc(0x64, file_out);
-       le_read64(tbuf, &wpt->position.longitude.degrees);
+       le_read64(tbuf, &wpt->longitude);
        fwrite(tbuf, 8, 1, file_out);
        if (wpt->notes) {
                fputc(5, file_out);
index 0e4d215963f08e20c35a5b940b09d17267e3e3dd..1b7efb6a9d87f24cdf8472ca58424a8abd71cc17 100644 (file)
@@ -75,8 +75,8 @@ waypt_read(void)
 
                wpt_tmp->shortname = xstrdup(way[i]->ident);
                wpt_tmp->description = xstrdup(way[i]->cmnt);
-               wpt_tmp->position.longitude.degrees = way[i]->lon;
-               wpt_tmp->position.latitude.degrees = way[i]->lat;
+               wpt_tmp->longitude = way[i]->lon;
+               wpt_tmp->latitude = way[i]->lat;
                wpt_tmp->icon_descr =
                        mps_find_desc_from_icon_number(way[i]->smbl, PCX);
                /*
@@ -92,9 +92,9 @@ waypt_read(void)
                     (way[i]->alt == INT_MAX) ||
                     (way[i]->alt == 1.0e25)
                     ) {
-                       wpt_tmp->position.altitude.altitude_meters = unknown_alt;
+                       wpt_tmp->altitude = unknown_alt;
                } else {
-                       wpt_tmp->position.altitude.altitude_meters = way[i]->alt;
+                       wpt_tmp->altitude = way[i]->alt;
                }
                
                waypt_add(wpt_tmp);
@@ -128,9 +128,9 @@ track_read(void)
                        route_add_head(trk_head);
                }
 
-               waypts[i].position.longitude.degrees = array[i]->lon;
-               waypts[i].position.latitude.degrees = array[i]->lat;
-               waypts[i].position.altitude.altitude_meters = array[i]->alt;
+               waypts[i].longitude = array[i]->lon;
+               waypts[i].latitude = array[i]->lat;
+               waypts[i].altitude = array[i]->alt;
                waypts[i].shortname = xstrdup(array[i]->trk_ident);
                waypts[i].creation_time = array[i]->Time;
                
@@ -262,11 +262,11 @@ data_write(void)
                if (src && strlen(src)) {
                        strncpy(way[i]->cmnt, src, sizeof(way[i]->cmnt));
                }
-               way[i]->lon = wpt->position.longitude.degrees;
-               way[i]->lat = wpt->position.latitude.degrees;
+               way[i]->lon = wpt->longitude;
+               way[i]->lat = wpt->latitude;
                way[i]->smbl = mps_find_icon_number_from_desc(wpt->icon_descr, PCX);
-               if (wpt->position.altitude.altitude_meters != unknown_alt) {
-                       way[i]->alt = wpt->position.altitude.altitude_meters;
+               if (wpt->altitude != unknown_alt) {
+                       way[i]->alt = wpt->altitude;
                }
                i++;
        }
index 39d44b0e985f95c3756320d904ccf70c5a84e4dc..861a3c08619c5a6cc4e9a8e1f78abd71a80a069f 100644 (file)
@@ -183,8 +183,8 @@ data_read(void)
                        }
                        recdata += (length + 1) & (~1);
                }
-               wpt->position.latitude.degrees = lat_dir * (lat_deg + lat_min/60);
-               wpt->position.longitude.degrees = lon_dir * (lon_deg + lon_min/60);
+               wpt->latitude = lat_dir * (lat_deg + lat_min/60);
+               wpt->longitude = lon_dir * (lon_deg + lon_min/60);
                waypt_add(wpt);
        }
 
@@ -255,24 +255,24 @@ gcdb_write_wpt(const waypoint *wpt)
        gcdb_add_to_rec(rec, "gcid", RECTYPE_TEXT, wpt->shortname);
 
        gcdb_add_to_rec(rec, "lat0", RECTYPE_TEXT, 
-                       wpt->position.latitude.degrees < 0 ? "S" : "N");
+                       wpt->latitude < 0 ? "S" : "N");
 
-       sprintf(tbuf, "%d", (int) wpt->position.latitude.degrees);
+       sprintf(tbuf, "%d", (int) wpt->latitude);
        gcdb_add_to_rec(rec, "lat1", RECTYPE_TEXT, tbuf);
 
-       sprintf(tbuf, "%f", 60 * (wpt->position.latitude.degrees - 
-                               (int) wpt->position.latitude.degrees));
+       sprintf(tbuf, "%f", 60 * (wpt->latitude - 
+                               (int) wpt->latitude));
        gcdb_add_to_rec(rec, "lat2", RECTYPE_TEXT, tbuf);
 
 
        gcdb_add_to_rec(rec, "lon0", RECTYPE_TEXT, 
-                       wpt->position.longitude.degrees < 0 ? "W" : "E");
+                       wpt->longitude < 0 ? "W" : "E");
 
-       sprintf(tbuf, "%d", (int) wpt->position.longitude.degrees);
+       sprintf(tbuf, "%d", (int) wpt->longitude);
        gcdb_add_to_rec(rec, "lon1", RECTYPE_TEXT, tbuf);
 
-       sprintf(tbuf, "%f", 60 * (wpt->position.longitude.degrees - 
-                               (int) wpt->position.longitude.degrees));
+       sprintf(tbuf, "%f", 60 * (wpt->longitude - 
+                               (int) wpt->longitude));
        gcdb_add_to_rec(rec, "lon2", RECTYPE_TEXT, tbuf);
 
        if (wpt->gc_data.diff) {
index f5d6da5375c783a5447eda01b77fe803a46f1c55..aa5f013c088c7c57db6eabea37c1932b79dcf55a 100644 (file)
@@ -59,11 +59,11 @@ tag_coord(const char **attrv)
        while (*avp) { 
                if (strcmp(avp[0], "lat") == 0) {
                        sscanf(avp[1], "%lf", 
-                               &wpt_tmp->position.latitude.degrees);
+                               &wpt_tmp->latitude);
                }
                else if (strcmp(avp[0], "lon") == 0) {
                        sscanf(avp[1], "%lf", 
-                               &wpt_tmp->position.longitude.degrees);
+                               &wpt_tmp->longitude);
                }
                avp+=2;
        }
@@ -111,7 +111,7 @@ geo_start(void *data, const char *el, const char **attr)
 
        if (in_wpt) {
                if (strcmp(el, "ele") == 0) {
-                       wpt_tmp->position.altitude.altitude_meters = atoi(attr[1]);
+                       wpt_tmp->altitude = atoi(attr[1]);
                }
                else if (strcmp(el, "name") == 0) {
                        tag_name(attr);
@@ -258,8 +258,8 @@ geo_waypt_pr(const waypoint *waypointp)
        fprintf(ofd, "</name>\n");
 
        fprintf(ofd, "<coord lat=\"%lf\" lon=\"%lf\"/>",
-               waypointp->position.latitude.degrees,
-               waypointp->position.longitude.degrees);
+               waypointp->latitude,
+               waypointp->longitude);
        fprintf(ofd, "\n");
 
        if (waypointp->icon_descr) {
index 92f437df31eb46741e8cebb29435102522e8a600..21660b0151b897b62feb0d8bf431673caf1b274a 100644 (file)
@@ -210,8 +210,8 @@ data_read(void)
                                 */
                                lon = le_read32(&rec->wpt.d103.lon);
                                lat = le_read32(&rec->wpt.d103.lat);
-                               wpt_tmp->position.longitude.degrees = lon / 2147483648.0 * 180.0;
-                               wpt_tmp->position.latitude.degrees = lat / 2147483648.0 * 180.0;
+                               wpt_tmp->longitude = lon / 2147483648.0 * 180.0;
+                               wpt_tmp->latitude = lat / 2147483648.0 * 180.0;
                                waypt_add(wpt_tmp);
                                break;
                        /*
@@ -228,8 +228,8 @@ data_read(void)
                                        wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
                                        lon = le_read32(&tp->lon);
                                        lat = le_read32(&tp->lat);
-                                       wpt_tmp->position.longitude.degrees = lon / 2147483648.0 * 180.0;
-                                       wpt_tmp->position.latitude.degrees = lat / 2147483648.0 * 180.0;
+                                       wpt_tmp->longitude = lon / 2147483648.0 * 180.0;
+                                       wpt_tmp->latitude = lat / 2147483648.0 * 180.0;
                                        route_add_wpt(track_head, wpt_tmp);
                                        tp++;
                                }
@@ -262,8 +262,8 @@ my_write_wpt(const waypoint *wpt)
        rec->header.type = 4;
        strncpy(rec->wpt.d103.ident, wpt->shortname, sizeof(rec->wpt.d103.ident));
        strncpy(rec->wpt.d103.cmnt, wpt->description, sizeof(rec->wpt.d103.cmnt));
-       lat = wpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-       lon = wpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+       lat = wpt->latitude  / 180.0 * 2147483648.0;
+       lon = wpt->longitude  / 180.0 * 2147483648.0;
        le_write32(&rec->wpt.d103.lat, lat);
        le_write32(&rec->wpt.d103.lon, lon);
 
index 1fb701ab1ee872c875ef9e43f451148866ed6831..2a785e1db0a4c4fb75e38f084bca803e8e3ca327 100644 (file)
@@ -101,10 +101,10 @@ data_read(void)
                                wpt_tmp->description = csv_stringtrim(s, " ");
                                break;
                        case 1:
-                               wpt_tmp->position.latitude.degrees = atof(s);
+                               wpt_tmp->latitude = atof(s);
                                break;
                        case 2:
-                               wpt_tmp->position.longitude.degrees = atof(s);
+                               wpt_tmp->longitude = atof(s);
                                break;
                        case 3:
                                rtrim(s);
@@ -146,8 +146,8 @@ gpsdrive_waypt_pr(const waypoint *wpt)
        char *isrc, *owpt;
        char *tmpstr;
 
-       lon = wpt->position.longitude.degrees;
-       lat = wpt->position.latitude.degrees;
+       lon = wpt->longitude;
+       lat = wpt->latitude;
 
        isrc = wpt->notes ? wpt->notes : wpt->description;
        if (global_opts.synthesize_shortnames) {
index 36805443d54f6b0c2a551914ebada19264f4351b..1b5e8538a71050699ada718b1aa64be4233d1174 100644 (file)
@@ -131,9 +131,9 @@ data_read(void)
                wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
 
                rec = (struct record *) pdb_rec->data;
-               wpt_tmp->position.longitude.degrees = be_read32(&rec->longitude) / 3.6e6; 
-               wpt_tmp->position.latitude.degrees = be_read32(&rec->latitude) / 3.6e6; 
-               wpt_tmp->position.altitude.altitude_meters =
+               wpt_tmp->longitude = be_read32(&rec->longitude) / 3.6e6; 
+               wpt_tmp->latitude = be_read32(&rec->latitude) / 3.6e6; 
+               wpt_tmp->altitude =
                  be_read16(&rec->elevation);
        
                vdata = (char *) pdb_rec->data + sizeof(*rec);
@@ -181,9 +181,9 @@ gpspilot_writewpt(const waypoint *wpt)
 
        rec = xcalloc(sizeof(*rec)+206,1);
        
-       be_write32(&rec->longitude, si_round(wpt->position.longitude.degrees * 3.6e6));
-       be_write32(&rec->latitude, si_round(wpt->position.latitude.degrees * 3.6e6));
-       be_write16(&rec->elevation, si_round(wpt->position.altitude.altitude_meters));
+       be_write32(&rec->longitude, si_round(wpt->longitude * 3.6e6));
+       be_write32(&rec->latitude, si_round(wpt->latitude * 3.6e6));
+       be_write16(&rec->elevation, si_round(wpt->altitude));
        be_write16(&rec->magvar, 0 );
        
        vdata = (char *)rec + sizeof(*rec);
index a0410ba66963691123b72c14d939e68da00a1c8a..1b536ef504d95ea7fa59f62ff9549e83064405f2 100644 (file)
@@ -68,7 +68,7 @@ data_read(void)
                rtrim(desc);
                rtrim(icon);
                wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
-               wpt_tmp->position.altitude.altitude_meters = alt;
+               wpt_tmp->altitude = alt;
                wpt_tmp->shortname = xstrdup(name);
                wpt_tmp->description = xstrdup(desc);
                wpt_tmp->creation_time = time(NULL);
@@ -79,9 +79,9 @@ data_read(void)
                lat /= 100.0;
                lon /= 100.0;
                ilon = (int)(lon);
-               wpt_tmp->position.longitude.degrees = ilon + (lon - ilon)*(100.0/60.0);
+               wpt_tmp->longitude = ilon + (lon - ilon)*(100.0/60.0);
                ilat = (int)(lat);
-               wpt_tmp->position.latitude.degrees = ilat + (lat - ilat) * (100.0/60.0);
+               wpt_tmp->latitude = ilat + (lat - ilat) * (100.0/60.0);
                wpt_tmp->icon_descr = mag_find_descr_from_token(icon);
                waypt_add(wpt_tmp);
        }
@@ -95,8 +95,8 @@ gpsutil_disp(const waypoint *wpt)
 
        icon_token = mag_find_token_from_descr(wpt->icon_descr);
 
-       lon = degrees2ddmm(wpt->position.longitude.degrees);
-       lat = degrees2ddmm(wpt->position.latitude.degrees);
+       lon = degrees2ddmm(wpt->longitude);
+       lat = degrees2ddmm(wpt->latitude);
 
        fprintf(file_out, "%-8s %08.3f%c %09.3f%c %07.0f%c %-30.30s %s\n",
                 global_opts.synthesize_shortnames ?
@@ -106,7 +106,7 @@ gpsutil_disp(const waypoint *wpt)
                lat < 0.0 ? 'S' : 'N',
                fabs(lon),
                lon < 0.0 ? 'W' : 'E',
-               wpt->position.altitude.altitude_meters,
+               wpt->altitude,
                'm', 
                wpt->description ? wpt->description : "",
                icon_token);
index 01c021587635b3e2dd2ac4d363a63c6b047c5440..244e60db36c7ef0c4f84f95f605d8f5c4479cdc1 100644 (file)
@@ -163,11 +163,11 @@ tag_wpt(const char **attrv)
        while (*avp) { 
                if (strcmp(avp[0], "lat") == 0) {
                        sscanf(avp[1], "%lf", 
-                               &wpt_tmp->position.latitude.degrees);
+                               &wpt_tmp->latitude);
                }
                else if (strcmp(avp[0], "lon") == 0) {
                        sscanf(avp[1], "%lf", 
-                               &wpt_tmp->position.longitude.degrees);
+                               &wpt_tmp->longitude);
                }
                avp+=2;
        }
@@ -257,11 +257,11 @@ tag_log_wpt(const char **attrv)
        while (*avp) { 
                if (strcmp(avp[0], "lat") == 0) {
                        sscanf(avp[1], "%lf", 
-                               &lwp_tmp->position.latitude.degrees);
+                               &lwp_tmp->latitude);
                }
                else if (strcmp(avp[0], "lon") == 0) {
                        sscanf(avp[1], "%lf", 
-                       &lwp_tmp->position.longitude.degrees);
+                       &lwp_tmp->longitude);
                }
                avp+=2;
        }
@@ -564,7 +564,7 @@ gpx_end(void *data, const char *el)
                }
                if (in_ele) {
                        sscanf(cdatastr, "%lf", 
-                               &wpt_tmp->position.altitude.altitude_meters);
+                               &wpt_tmp->altitude);
                }
                if (in_time) {
                        if ( in_wpt || in_rte || in_trkpt || in_rtept) {
@@ -965,8 +965,8 @@ gpx_waypt_pr(const waypoint *waypointp)
                                  waypointp->shortname;
 
        fprintf(ofd, "<wpt lat=\"%lf\" lon=\"%lf\">\n",
-               waypointp->position.latitude.degrees,
-               waypointp->position.longitude.degrees);
+               waypointp->latitude,
+               waypointp->longitude);
        if (waypointp->creation_time) {
                gpx_write_time(waypointp->creation_time, "time");
        }
@@ -991,9 +991,9 @@ gpx_waypt_pr(const waypoint *waypointp)
                        fprintf(ofd, "</desc>\n");
                }
        }
-       if (waypointp->position.altitude.altitude_meters) {
+       if (waypointp->altitude) {
                fprintf(ofd, "<ele>\n%f\n</ele>\n",
-                        waypointp->position.altitude.altitude_meters);
+                        waypointp->altitude);
        }
        if (waypointp->url) {
                tmp_ent = gpx_entitize(waypointp->url);
@@ -1041,11 +1041,11 @@ static void
 gpx_track_disp(const waypoint *waypointp)
 {
        fprintf(ofd, "<trkpt lat=\"%lf\" lon=\"%lf\">\n",
-               waypointp->position.latitude.degrees,
-               waypointp->position.longitude.degrees);
-       if (waypointp->position.altitude.altitude_meters != unknown_alt) {
+               waypointp->latitude,
+               waypointp->longitude);
+       if (waypointp->altitude != unknown_alt) {
                fprintf(ofd, "<ele>%f</ele>\n",
-                        waypointp->position.altitude.altitude_meters);
+                        waypointp->altitude);
        }
        if (waypointp->creation_time) {
                gpx_write_time(waypointp->creation_time,"time");
@@ -1091,12 +1091,12 @@ static void
 gpx_route_disp(const waypoint *waypointp)
 {
        fprintf(ofd, "<rtept lat=\"%f\" lon=\"%f\">\n",
-               waypointp->position.latitude.degrees,
-               waypointp->position.longitude.degrees);
+               waypointp->latitude,
+               waypointp->longitude);
 
-       if (waypointp->position.altitude.altitude_meters != unknown_alt) {
+       if (waypointp->altitude != unknown_alt) {
                fprintf(ofd, "<ele>%f</ele>\n",
-                        waypointp->position.altitude.altitude_meters);
+                        waypointp->altitude);
        }
        if (waypointp->creation_time) {
                gpx_write_time(waypointp->creation_time,"time");
index 14e1a93730cc1d805b3840a6f83e9fa2ce68d9ac..8a9931c876b44fa309eab05c53f59b79a2005f78 100644 (file)
@@ -113,7 +113,7 @@ static void data_read(void)
        iWptIndex = le_read16(&((WPTHDR *)HxWpt)->idx[iCount]);
         pWptHxTmp =  (WPT *)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)];
         
-        wpt_tmp->position.altitude.altitude_meters = 0;
+        wpt_tmp->altitude = 0;
         strncpy(name,pWptHxTmp->name,sizeof(pWptHxTmp->name));
         name[sizeof(pWptHxTmp->name)]=0;
         
@@ -139,8 +139,8 @@ static void data_read(void)
 
         lon = le_read32(&pWptHxTmp->pt.iLongitude) / 36000.0; 
         lat = (le_read32(&pWptHxTmp->pt.iLatitude)  / 36000.0) * -1.0;
-               wpt_tmp->position.longitude.degrees = lon;
-               wpt_tmp->position.latitude.degrees = lat;
+               wpt_tmp->longitude = lon;
+               wpt_tmp->latitude = lat;
                waypt_add(wpt_tmp);
        }
     xfree(HxWpt);
@@ -184,8 +184,8 @@ static void holux_disp(const waypoint *wpt)
     short sIndex;
     WPT *pWptHxTmp;
 
-       lon =(double)wpt->position.longitude.degrees * 36000;
-       lat =(double)wpt->position.latitude.degrees * -36000;
+       lon =(double)wpt->longitude * 36000;
+       lat =(double)wpt->latitude * -36000;
 
 
     /* round it to increase the accuracy */
index f7c13815e20e1e6d8473048ec5c27dcbc90842ac..03068d2d99d312ef43b0bc16459ea3525d5fc656 100644 (file)
@@ -114,10 +114,10 @@ data_read(void)
                memset (&tm, sizeof(tm), 0);
                wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
                rec = (struct record *) pdb_rec->data;
-               wpt_tmp->position.altitude.altitude_meters = be_read32(&rec->elevation); 
+               wpt_tmp->altitude = be_read32(&rec->elevation); 
 
-               wpt_tmp->position.longitude.degrees = be_read32(&rec->longitude) / 1e5; 
-               wpt_tmp->position.latitude.degrees = be_read32(&rec->latitude) / 1e5; 
+               wpt_tmp->longitude = be_read32(&rec->longitude) / 1e5; 
+               wpt_tmp->latitude = be_read32(&rec->latitude) / 1e5; 
 
                vdata = (char *) pdb_rec->data + sizeof(*rec);
 
@@ -183,9 +183,9 @@ my_writewpt(const waypoint *wpt)
        
         be_write16( &rec->unknown2, 0);
        
-       be_write32(&rec->longitude, si_round(wpt->position.longitude.degrees * 100000.0));
-       be_write32(&rec->latitude, si_round(wpt->position.latitude.degrees * 100000.0));
-       be_write32(&rec->elevation, wpt->position.altitude.altitude_meters);
+       be_write32(&rec->longitude, si_round(wpt->longitude * 100000.0));
+       be_write32(&rec->latitude, si_round(wpt->latitude * 100000.0));
+       be_write32(&rec->elevation, wpt->altitude);
 
        rec->plot = 0;
        rec->unknown3 = 'a';
index 2cf8f9a995a8e36c752e83267084bc80b87381ba..c88512683fb0b3425e2cd973c52b344d35f59a22 100644 (file)
@@ -164,9 +164,9 @@ decode(char *buf)
 
                for (; vdata < edata; rec = (struct record *) vdata) {
                        wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
-                       wpt_tmp->position.latitude.degrees = Lat1 + 
+                       wpt_tmp->latitude = Lat1 + 
                                be_read16(&rec->lat1d) / LATDIV2; 
-                       wpt_tmp->position.longitude.degrees = Lon1 + 
+                       wpt_tmp->longitude = Lon1 + 
                                be_read16(&rec->lon1d) / LONDIV2; 
 
                        vdata = (char *) rec + sizeof(*rec);
@@ -228,9 +228,9 @@ my_writewpt(const waypoint *wpt)
        
         be_write16( &rec->unknown2, 0);
        
-       be_write32(&rec->longitude, si_round(wpt->position.longitude.degrees * 100000.0));
-       be_write32(&rec->latitude, si_round(wpt->position.latitude.degrees * 100000.0));
-       be_write32(&rec->elevation, wpt->position.altitude.altitude_meters);
+       be_write32(&rec->longitude, si_round(wpt->longitude * 100000.0));
+       be_write32(&rec->latitude, si_round(wpt->latitude * 100000.0));
+       be_write32(&rec->elevation, wpt->altitude);
 
        rec->plot = 0;
        rec->unknown3 = 'a';
index 43da0edca8d783910011e40a5447f311a7b89611..23af6e9e0c8d91cd5a8b7f93c42e59e2c8548309 100644 (file)
@@ -231,9 +231,9 @@ mapsend_wpt_read(void)
 
                wpt_tmp->shortname = xstrdup(name);
                wpt_tmp->description = xstrdup(comment);
-               wpt_tmp->position.altitude.altitude_meters = wpt_alt;
-               wpt_tmp->position.latitude.degrees = -wpt_lat;
-               wpt_tmp->position.longitude.degrees = wpt_long;
+               wpt_tmp->altitude = wpt_alt;
+               wpt_tmp->latitude = -wpt_lat;
+               wpt_tmp->longitude = wpt_long;
 
                if (wpt_icon < 26)
                        sprintf(tbuf, "%c", wpt_icon + 'a');
@@ -280,8 +280,8 @@ mapsend_wpt_read(void)
                        my_fread8(&wpt_lat, mapsend_file_in);
                        fread(&wpt_icon, sizeof(wpt_icon), 1, mapsend_file_in);
 
-                       wpt_tmp->position.longitude.degrees = wpt_long;
-                       wpt_tmp->position.latitude.degrees = -wpt_lat;
+                       wpt_tmp->longitude = wpt_long;
+                       wpt_tmp->latitude = -wpt_lat;
 
                        if (wpt_icon < 26)
                                sprintf(tbuf, "%c", wpt_icon + 'a');
@@ -342,11 +342,11 @@ mapsend_track_read(void)
                }
 
                wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
-               wpt_tmp->position.latitude.degrees = -wpt_lat;
-               wpt_tmp->position.longitude.degrees = wpt_long;
+               wpt_tmp->latitude = -wpt_lat;
+               wpt_tmp->longitude = wpt_long;
                wpt_tmp->creation_time = time;
                wpt_tmp->centiseconds = centisecs;
-               wpt_tmp->position.altitude.altitude_meters = wpt_alt;
+               wpt_tmp->altitude = wpt_alt;
                route_add_wpt(track_head, wpt_tmp);
        }
 }
@@ -441,12 +441,12 @@ mapsend_waypt_pr(const waypoint *waypointp)
        c = 1;
        fwrite(&c, 1, 1, mapsend_file_out);
 
-       falt = waypointp->position.altitude.altitude_meters;
+       falt = waypointp->altitude;
        my_fwrite8(&falt, mapsend_file_out);
 
-       flong = waypointp->position.longitude.degrees;
+       flong = waypointp->longitude;
        my_fwrite8(&flong, mapsend_file_out);
-       flat = -waypointp->position.latitude.degrees;
+       flat = -waypointp->latitude;
        my_fwrite8(&flat, mapsend_file_out);
 }
 
@@ -503,10 +503,10 @@ mapsend_route_disp(const waypoint *waypointp)
        /* waypoint number */
        my_fwrite4(&route_wp_count, mapsend_file_out);
 
-       dbl = waypointp->position.longitude.degrees;
+       dbl = waypointp->longitude;
        my_fwrite8(&dbl, mapsend_file_out);
 
-       dbl = -waypointp->position.latitude.degrees;
+       dbl = -waypointp->latitude;
        my_fwrite8(&dbl, mapsend_file_out);
 
        if (waypointp->icon_descr) {
@@ -579,12 +579,14 @@ void mapsend_track_disp(const waypoint * wpt)
        static int last_time;
 
        /*
-        * Version 4.06 (at least) has a defect when it's set for .01km
+        * Firmware Ver 4.06 (at least) has a defect when it's set for .01km
         * tracking that will sometimes result in timestamps in the track
         * going BACKWARDS.   When mapsend sees this, it (stupidly) advances
         * the date by one, ignoring the date on the TRK lines.   This looks 
         * for time travel and just uses the previous time - it's better to
         * be thought to be standing still than to be time-travelling!
+        *
+        * This is rumoured (but yet unconfirmed) to be fixed in f/w 5.12.
         */
        t = wpt->creation_time;
        if (t < last_time)  {
@@ -592,15 +594,15 @@ void mapsend_track_disp(const waypoint * wpt)
        }
        
        /* x = longitude */
-       dbl = wpt->position.longitude.degrees;
+       dbl = wpt->longitude;
        my_fwrite8(&dbl, mapsend_file_out);
 
        /* x = latitude */
-       dbl = -wpt->position.latitude.degrees;
+       dbl = -wpt->latitude;
        my_fwrite8(&dbl, mapsend_file_out);
 
        /* altitude */
-       i = wpt->position.altitude.altitude_meters;
+       i = wpt->altitude;
        my_fwrite4(&i, mapsend_file_out);
        
        /* time */
index 90011ea24501c21caa06a67c607a66e95afe0ccb..3106939bb09641c30fc8156a183504f760d9d509 100644 (file)
@@ -473,9 +473,9 @@ mps_waypoint_r(FILE *mps_file, int mps_ver, waypoint **wpt)
 
        thisWaypoint->shortname = xstrdup(wptname);
        thisWaypoint->description = xstrdup(wptdesc);
-       thisWaypoint->position.latitude.degrees = lat / 2147483648.0 * 180.0;
-       thisWaypoint->position.longitude.degrees = lon / 2147483648.0 * 180.0;
-       thisWaypoint->position.altitude.altitude_meters = mps_altitude;
+       thisWaypoint->latitude = lat / 2147483648.0 * 180.0;
+       thisWaypoint->longitude = lon / 2147483648.0 * 180.0;
+       thisWaypoint->altitude = mps_altitude;
 
        /* might need to change this to handle version dependent icon handling */
        thisWaypoint->icon_descr = mps_find_desc_from_icon_number(icon, MAPSOURCE);
@@ -494,8 +494,8 @@ mps_waypoint_w(FILE *mps_file, int mps_ver, const waypoint *wpt)
 {
        unsigned char hdr[100];
        int reclen;
-       int lat = wpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-       int lon = wpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+       int lat = wpt->latitude  / 180.0 * 2147483648.0;
+       int lon = wpt->longitude  / 180.0 * 2147483648.0;
        int     icon;
        char *src;
        char *ident;
@@ -504,7 +504,7 @@ mps_waypoint_w(FILE *mps_file, int mps_ver, const waypoint *wpt)
        int display = 1;
        int colour = 0;                 /*  (unknown colour) black is 1, white is 16 */
 
-       double  mps_altitude = wpt->position.altitude.altitude_meters;
+       double  mps_altitude = wpt->altitude;
        double  mps_proximity = unknown_alt;
        double  mps_depth = unknown_alt;
 
@@ -736,9 +736,9 @@ mps_route_r(FILE *mps_file, int mps_ver, route_head **rte)
                else {
                        thisWaypoint = xcalloc(sizeof(*thisWaypoint), 1);
                        thisWaypoint->shortname = xstrdup(wptname);
-                       thisWaypoint->position.latitude.degrees = lat / 2147483648.0 * 180.0;
-                       thisWaypoint->position.longitude.degrees = lon / 2147483648.0 * 180.0;
-                       thisWaypoint->position.altitude.altitude_meters = mps_altitude;
+                       thisWaypoint->latitude = lat / 2147483648.0 * 180.0;
+                       thisWaypoint->longitude = lon / 2147483648.0 * 180.0;
+                       thisWaypoint->altitude = mps_altitude;
                }
 
                route_add_wpt(rte_head, thisWaypoint);
@@ -806,9 +806,9 @@ mps_route_r(FILE *mps_file, int mps_ver, route_head **rte)
        else {
                thisWaypoint = xcalloc(sizeof(*thisWaypoint), 1);
                thisWaypoint->shortname = xstrdup(wptname);
-               thisWaypoint->position.latitude.degrees = lat / 2147483648.0 * 180.0;
-               thisWaypoint->position.longitude.degrees = lon / 2147483648.0 * 180.0;
-               thisWaypoint->position.altitude.altitude_meters = mps_altitude;
+               thisWaypoint->latitude = lat / 2147483648.0 * 180.0;
+               thisWaypoint->longitude = lon / 2147483648.0 * 180.0;
+               thisWaypoint->altitude = mps_altitude;
        }
 
        route_add_wpt(rte_head, thisWaypoint);
@@ -863,15 +863,15 @@ mps_routehdr_w(FILE *mps_file, int mps_ver, const route_head *rte)
                        if (rte_datapoints == 0) {
                                uniqueValue = testwpt->creation_time;
                        }
-                       if (testwpt->position.latitude.degrees > maxlat) maxlat = testwpt->position.latitude.degrees;
-                       if (testwpt->position.latitude.degrees < minlat) minlat = testwpt->position.latitude.degrees;
-                       if (testwpt->position.longitude.degrees > maxlon) maxlon = testwpt->position.longitude.degrees;
-                       if (testwpt->position.longitude.degrees < minlon) minlon = testwpt->position.longitude.degrees;
-                       if (testwpt->position.altitude.altitude_meters != unknown_alt) {
-                               if ((testwpt->position.altitude.altitude_meters > maxalt) || 
-                                       (maxalt == unknown_alt)) maxalt = testwpt->position.altitude.altitude_meters;
-                               if ((testwpt->position.altitude.altitude_meters < minalt) ||
-                                       (minalt == unknown_alt)) minalt = testwpt->position.altitude.altitude_meters;
+                       if (testwpt->latitude > maxlat) maxlat = testwpt->latitude;
+                       if (testwpt->latitude < minlat) minlat = testwpt->latitude;
+                       if (testwpt->longitude > maxlon) maxlon = testwpt->longitude;
+                       if (testwpt->longitude < minlon) minlon = testwpt->longitude;
+                       if (testwpt->altitude != unknown_alt) {
+                               if ((testwpt->altitude > maxalt) || 
+                                       (maxalt == unknown_alt)) maxalt = testwpt->altitude;
+                               if ((testwpt->altitude < minalt) ||
+                                       (minalt == unknown_alt)) minalt = testwpt->altitude;
                        }
 
                        if(testwpt->description) src = testwpt->description;
@@ -1017,15 +1017,15 @@ mps_routedatapoint_w(FILE *mps_file, int mps_ver, const waypoint *rtewpt)
                fwrite(&reclen, 4, 1, mps_file);
 
                /* output end point 1 */
-               lat = prevRouteWpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-               lon = prevRouteWpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+               lat = prevRouteWpt->latitude  / 180.0 * 2147483648.0;
+               lon = prevRouteWpt->longitude  / 180.0 * 2147483648.0;
                le_write32(&lat, lat);
                le_write32(&lon, lon);
 
                fwrite(&lat, 4, 1, mps_file);
                fwrite(&lon, 4, 1, mps_file);
 
-               mps_altitude = prevRouteWpt->position.altitude.altitude_meters;
+               mps_altitude = prevRouteWpt->altitude;
                if (mps_altitude == unknown_alt) {
                        fwrite(zbuf, 9, 1, mps_file);
                }
@@ -1036,15 +1036,15 @@ mps_routedatapoint_w(FILE *mps_file, int mps_ver, const waypoint *rtewpt)
                }
 
                /* output end point 2 */
-               lat = rtewpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-               lon = rtewpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+               lat = rtewpt->latitude  / 180.0 * 2147483648.0;
+               lon = rtewpt->longitude  / 180.0 * 2147483648.0;
                le_write32(&lat, lat);
                le_write32(&lon, lon);
 
                fwrite(&lat, 4, 1, mps_file);
                fwrite(&lon, 4, 1, mps_file);
 
-               mps_altitude = rtewpt->position.altitude.altitude_meters;
+               mps_altitude = rtewpt->altitude;
                if (mps_altitude == unknown_alt) {
                        fwrite(zbuf, 9, 1, mps_file);
                }
@@ -1054,31 +1054,31 @@ mps_routedatapoint_w(FILE *mps_file, int mps_ver, const waypoint *rtewpt)
                        fwrite(&mps_altitude, 8 , 1, mps_file);
                }
 
-               if (rtewpt->position.latitude.degrees > prevRouteWpt->position.latitude.degrees) {
-                       maxlat = rtewpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-                       minlat = prevRouteWpt->position.latitude.degrees  / 180.0 * 2147483648.0;
+               if (rtewpt->latitude > prevRouteWpt->latitude) {
+                       maxlat = rtewpt->latitude  / 180.0 * 2147483648.0;
+                       minlat = prevRouteWpt->latitude  / 180.0 * 2147483648.0;
                }
                else {
-                       minlat = rtewpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-                       maxlat = prevRouteWpt->position.latitude.degrees  / 180.0 * 2147483648.0;
+                       minlat = rtewpt->latitude  / 180.0 * 2147483648.0;
+                       maxlat = prevRouteWpt->latitude  / 180.0 * 2147483648.0;
                }
 
-               if (rtewpt->position.longitude.degrees > prevRouteWpt->position.longitude.degrees) {
-                       maxlon = rtewpt->position.longitude.degrees  / 180.0 * 2147483648.0;
-                       minlon = prevRouteWpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+               if (rtewpt->longitude > prevRouteWpt->longitude) {
+                       maxlon = rtewpt->longitude  / 180.0 * 2147483648.0;
+                       minlon = prevRouteWpt->longitude  / 180.0 * 2147483648.0;
                }
                else {
-                       minlon = rtewpt->position.longitude.degrees  / 180.0 * 2147483648.0;
-                       maxlon = prevRouteWpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+                       minlon = rtewpt->longitude  / 180.0 * 2147483648.0;
+                       maxlon = prevRouteWpt->longitude  / 180.0 * 2147483648.0;
                }
 
-               if (rtewpt->position.altitude.altitude_meters != unknown_alt) maxalt = rtewpt->position.altitude.altitude_meters;
-               if (rtewpt->position.altitude.altitude_meters != unknown_alt) minalt = rtewpt->position.altitude.altitude_meters;
-               if (prevRouteWpt->position.altitude.altitude_meters != unknown_alt) {
-                       if ((prevRouteWpt->position.altitude.altitude_meters > maxalt) || 
-                               (maxalt == unknown_alt)) maxalt = prevRouteWpt->position.altitude.altitude_meters;
-                       if ((prevRouteWpt->position.altitude.altitude_meters < minalt) ||
-                               (minalt == unknown_alt)) minalt = prevRouteWpt->position.altitude.altitude_meters;
+               if (rtewpt->altitude != unknown_alt) maxalt = rtewpt->altitude;
+               if (rtewpt->altitude != unknown_alt) minalt = rtewpt->altitude;
+               if (prevRouteWpt->altitude != unknown_alt) {
+                       if ((prevRouteWpt->altitude > maxalt) || 
+                               (maxalt == unknown_alt)) maxalt = prevRouteWpt->altitude;
+                       if ((prevRouteWpt->altitude < minalt) ||
+                               (minalt == unknown_alt)) minalt = prevRouteWpt->altitude;
                }
                
                fwrite (zbuf, 1, 1, mps_file);
@@ -1258,11 +1258,11 @@ mps_track_r(FILE *mps_file, int mps_ver, route_head **trk)
                }
 
                thisWaypoint = xcalloc(sizeof(*thisWaypoint), 1);
-               thisWaypoint->position.latitude.degrees = lat / 2147483648.0 * 180.0;
-               thisWaypoint->position.longitude.degrees = lon / 2147483648.0 * 180.0;
+               thisWaypoint->latitude = lat / 2147483648.0 * 180.0;
+               thisWaypoint->longitude = lon / 2147483648.0 * 180.0;
                thisWaypoint->creation_time = dateTime;
                thisWaypoint->centiseconds = 0;
-               thisWaypoint->position.altitude.altitude_meters = mps_altitude;
+               thisWaypoint->altitude = mps_altitude;
                route_add_wpt(track_head, thisWaypoint);
 
        }               /* while (trk_count--) */
@@ -1355,12 +1355,12 @@ static void
 mps_trackdatapoint_w(FILE *mps_file, int mps_ver, const waypoint *wpt)
 {
        unsigned char hdr[10];
-       int lat = wpt->position.latitude.degrees  / 180.0 * 2147483648.0;
-       int lon = wpt->position.longitude.degrees  / 180.0 * 2147483648.0;
+       int lat = wpt->latitude  / 180.0 * 2147483648.0;
+       int lon = wpt->longitude  / 180.0 * 2147483648.0;
        time_t  t = wpt->creation_time;
        char zbuf[10];
 
-       double  mps_altitude = wpt->position.altitude.altitude_meters;
+       double  mps_altitude = wpt->altitude;
        double  mps_proximity = unknown_alt;
        double  mps_depth = unknown_alt;
 
index de6d2500c4a3958aff54b579fa0f8852712a9645..127d9c885f28a7177770e35016a3faf6b410518f 100644 (file)
@@ -112,15 +112,15 @@ nav_start(void *data, const char *el, const char **attr)
                        } else
                        if (0 == strcmp(ap[0], "latitude")) {
                                sscanf(ap[1], "%lf", 
-                               &wpt_tmp->position.latitude.degrees);
+                               &wpt_tmp->latitude);
                        } else
                        if (0 == strcmp(ap[0], "longitude")) {
                                sscanf(ap[1], "%lf", 
-                               &wpt_tmp->position.longitude.degrees);
+                               &wpt_tmp->longitude);
                        } else
                        if (0 == strcmp(ap[0], "longitude")) {
                                sscanf(ap[1], "%lf", 
-                               &wpt_tmp->position.longitude.degrees);
+                               &wpt_tmp->longitude);
                        } else
                        if (0 == strcmp(ap[0], "difficulty")) {
                                float x;
index e1a98948449abdfa05c9134b18c9bbf0fd4f91bc..112837a06aaebfe03de89dd32124b7d8625ee643 100644 (file)
@@ -95,15 +95,15 @@ data_read(void)
                        desc[sizeof(desc)-1] = '\0';
                        name[sizeof(name)-1] = '\0';
                        wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
-                       wpt_tmp->position.altitude.altitude_meters = alt;
+                       wpt_tmp->altitude = alt;
                        wpt_tmp->shortname = xstrdup(name);
                        wpt_tmp->description = xstrdup(desc);
                        wpt_tmp->icon_descr = mps_find_desc_from_icon_number(symnum, PCX);
 
                        if (latdir == 'S') lat = -lat;
                        if (londir == 'W') lon = -lon;
-                       wpt_tmp->position.longitude.degrees = ddmm2degrees(lon);
-                       wpt_tmp->position.latitude.degrees = ddmm2degrees(lat);
+                       wpt_tmp->longitude = ddmm2degrees(lon);
+                       wpt_tmp->latitude = ddmm2degrees(lat);
                        waypt_add(wpt_tmp);
                        break;
                default:
@@ -121,8 +121,8 @@ gpsutil_disp(const waypoint *wpt)
        char *tp = tbuf;
        time_t tm = wpt->creation_time;
 
-       lon = degrees2ddmm(wpt->position.longitude.degrees);
-       lat = degrees2ddmm(wpt->position.latitude.degrees);
+       lon = degrees2ddmm(wpt->longitude);
+       lat = degrees2ddmm(wpt->latitude);
 
        if (tm == 0) 
                tm = time(NULL);
index c4cd8e3fc4a775ff6027ee850110fdbcf78895fa..d68e92d068544a283b490ebb957c15e8d3f42474 100644 (file)
@@ -238,8 +238,8 @@ polygon_process(void)
                    last = 1;
                }
                polytest( lat1, lon1, lat2, lon2, 
-                       waypointp->position.latitude.degrees,
-                       waypointp->position.longitude.degrees,
+                       waypointp->latitude,
+                       waypointp->longitude,
                        &ed->state, first, last );
                first = 0;
                last = 0;
index 56eb7ec5d4619cdebb084013f07d3ff91f69bd0f..c3ea570bd90015c715f9838304471768fe085f14 100644 (file)
@@ -92,10 +92,10 @@ position_comp(const void * a, const void * b)
         * point.
         */
 
-       londiff = (x1->position.longitude.degrees -
-                  x2->position.longitude.degrees) * 1000000.0;
-       latdiff = (x1->position.latitude.degrees -
-                  x2->position.latitude.degrees) * 1000000.0;
+       londiff = (x1->longitude -
+                  x2->longitude) * 1000000.0;
+       latdiff = (x1->latitude -
+                  x2->latitude) * 1000000.0;
 
        max = fabs(londiff) >= fabs(latdiff) ? floor(londiff) : floor(latdiff);
 
@@ -145,10 +145,10 @@ position_process(void)
        qsort(comp, wc, sizeof(waypoint *), position_comp);
 
        for (i = 0 ; i < (wc - 1) ; i++) {
-               dist = gc_distance(comp[i]->position.latitude.degrees,
-                                  comp[i]->position.longitude.degrees,
-                                  comp[i+1]->position.latitude.degrees,
-                                  comp[i+1]->position.longitude.degrees);
+               dist = gc_distance(comp[i]->latitude,
+                                  comp[i]->longitude,
+                                  comp[i+1]->latitude,
+                                  comp[i+1]->longitude);
 
                /* convert radians to integer feet */
                dist = (int)((((dist * 180.0 * 60.0) / M_PI) * 1.1516) * 5280.0);
@@ -197,10 +197,10 @@ radius_process(void)
                extra_data *ed;
 
                waypointp = (waypoint *)elem;
-               dist = gc_distance(waypointp->position.latitude.degrees,
-                                  waypointp->position.longitude.degrees,
-                                  home_pos->position.latitude.degrees,
-                                  home_pos->position.longitude.degrees);
+               dist = gc_distance(waypointp->latitude,
+                                  waypointp->longitude,
+                                  home_pos->latitude,
+                                  home_pos->longitude);
 
                /* convert radians to float point statute miles */
                dist = (((dist * 180.0 * 60.0) / M_PI) * 1.1516);
@@ -272,9 +272,9 @@ radius_init(const char *args) {
        home_pos = xcalloc(sizeof(*home_pos), 1);
 
        if (latopt)
-               home_pos->position.latitude.degrees = atof(latopt);
+               home_pos->latitude = atof(latopt);
        if (lonopt)
-               home_pos->position.longitude.degrees = atof(lonopt);
+               home_pos->longitude = atof(lonopt);
 }
 
 void
index 2bb1a1482df201b1be2facaaa50c7fffba58bcd6..e406c20f5e9bc518a2092a2657396a2300de364e 100755 (executable)
@@ -313,17 +313,17 @@ psit_waypoint_r(FILE *psit_file, waypoint **wpt)
        if (strlen(psit_current_token) > 0) {
                thisWaypoint = xcalloc(sizeof(*thisWaypoint), 1);
 
-               thisWaypoint->position.latitude.degrees = atof(psit_current_token);
+               thisWaypoint->latitude = atof(psit_current_token);
 
                psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
-               thisWaypoint->position.longitude.degrees = atof(psit_current_token);
+               thisWaypoint->longitude = atof(psit_current_token);
 
                psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
                if (psit_current_token[0] == '*') {
-                       thisWaypoint->position.altitude.altitude_meters = unknown_alt;
+                       thisWaypoint->altitude = unknown_alt;
                }
                else {
-                       thisWaypoint->position.altitude.altitude_meters = atof(psit_current_token);
+                       thisWaypoint->altitude = atof(psit_current_token);
                }
 
                /* the name */
@@ -359,14 +359,14 @@ psit_waypoint_w(FILE *psit_file, const waypoint *wpt)
        int colour = 0;                 /*  (unknown colour) black is 1, white is 16 */
 
        fprintf(psit_file, "%11.6f,%11.6f,", 
-                                               wpt->position.latitude.degrees,
-                                               wpt->position.longitude.degrees);
+                                               wpt->latitude,
+                                               wpt->longitude);
 
-       if (wpt->position.altitude.altitude_meters == unknown_alt) 
+       if (wpt->altitude == unknown_alt) 
                fprintf(psit_file, "********,");
        else
                fprintf(psit_file, "%8.2f,",
-                                               wpt->position.altitude.altitude_meters);
+                                               wpt->altitude);
 
        ident = global_opts.synthesize_shortnames ?
                                mkshort(mkshort_handle, src) :
@@ -439,17 +439,17 @@ psit_route_r(FILE *psit_file, route_head **rte)
                if (strlen(psit_current_token) > 0) {
                        thisWaypoint = xcalloc(sizeof(*thisWaypoint), 1);
 
-                       thisWaypoint->position.latitude.degrees = atof(psit_current_token);
+                       thisWaypoint->latitude = atof(psit_current_token);
 
                        psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
-                       thisWaypoint->position.longitude.degrees = atof(psit_current_token);
+                       thisWaypoint->longitude = atof(psit_current_token);
 
                        psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
                        if (psit_current_token[0] == '*') {
-                               thisWaypoint->position.altitude.altitude_meters = unknown_alt;
+                               thisWaypoint->altitude = unknown_alt;
                        }
                        else {
-                               thisWaypoint->position.altitude.altitude_meters = atof(psit_current_token);
+                               thisWaypoint->altitude = atof(psit_current_token);
                        }
 
                        /* the name */
@@ -569,17 +569,17 @@ psit_track_r(FILE *psit_file, route_head **trk)
                if (strlen(psit_current_token) > 0) {
                        thisWaypoint = xcalloc(sizeof(*thisWaypoint), 1);
 
-                       thisWaypoint->position.latitude.degrees = atof(psit_current_token);
+                       thisWaypoint->latitude = atof(psit_current_token);
 
                        psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
-                       thisWaypoint->position.longitude.degrees = atof(psit_current_token);
+                       thisWaypoint->longitude = atof(psit_current_token);
 
                        psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), comma);
                        if (psit_current_token[0] == '*') {
-                               thisWaypoint->position.altitude.altitude_meters = unknown_alt;
+                               thisWaypoint->altitude = unknown_alt;
                        }
                        else {
-                               thisWaypoint->position.altitude.altitude_meters = atof(psit_current_token);
+                               thisWaypoint->altitude = atof(psit_current_token);
                        }
 
                        /* date portion of the date time DD/MM/YY */
@@ -696,19 +696,19 @@ psit_trackdatapoint_w(FILE *psit_file, const waypoint *wpt)
        time_t  t = wpt->creation_time;
        struct tm *tmTime = gmtime(&t);
 
-       double  psit_altitude = wpt->position.altitude.altitude_meters;
+       double  psit_altitude = wpt->altitude;
        double  psit_proximity = unknown_alt;
        double  psit_depth = unknown_alt;
 
        fprintf(psit_file, "%11.6f,%11.6f,", 
-                                               wpt->position.latitude.degrees,
-                                               wpt->position.longitude.degrees);
+                                               wpt->latitude,
+                                               wpt->longitude);
 
-       if (wpt->position.altitude.altitude_meters == unknown_alt) 
+       if (wpt->altitude == unknown_alt) 
                fprintf(psit_file, "********, ");
        else
                fprintf(psit_file, "%8.2f, ",
-                                               wpt->position.altitude.altitude_meters);
+                                               wpt->altitude);
 
        /* Following date time format is fixed and reveals the origin of PsiTrex (i.e. the UK) */
        fprintf(psit_file, "%02d/%02d/%02d %02d:%02d:%02d,",
index b07657498983667de6de1c186b3b9a742a688d8e..20737ef34f43c3dbe19c8661b43972ac32dc4207 100644 (file)
@@ -298,7 +298,7 @@ psp_read(void)
        while (pincount--) {
            wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
 
-            wpt_tmp->position.altitude.altitude_meters = unknown_alt;
+            wpt_tmp->altitude = unknown_alt;
             
             /* offset 0x20 - 0x21 pin index */
            psp_fread(&pindex, 1, 2, psp_file_in);
@@ -326,8 +326,8 @@ psp_read(void)
 
             decode_psp_coordinates(&lat, &lon, gridbyte);
 
-            wpt_tmp->position.latitude.degrees = lat;
-            wpt_tmp->position.longitude.degrees = lon;
+            wpt_tmp->latitude = lat;
+            wpt_tmp->longitude = lon;
            
             /* 1 byte - pin display properties */
             psp_fread(&buff[0], 1, 1, psp_file_in);
@@ -430,8 +430,8 @@ psp_waypt_pr(const waypoint *wpt)
         }
 
         /* convert lat/long back to radians */
-       lat = (wpt->position.latitude.degrees * M_PI) / 180.0;
-        lon = (wpt->position.longitude.degrees * M_PI) / 180.0;
+       lat = (wpt->latitude * M_PI) / 180.0;
+        lon = (wpt->longitude * M_PI) / 180.0;
         
        pindex++;
        le_write16(tbuf, pindex);
@@ -444,8 +444,8 @@ psp_waypt_pr(const waypoint *wpt)
         
 
         /* set the grid byte */
-       c = grid_byte(wpt->position.latitude.degrees
-                     wpt->position.longitude.degrees);
+       c = grid_byte(wpt->latitude
+                     wpt->longitude);
 
        /* since the grid byte matches with what pocketstreets does to   */
        /* input files, our output appears identical to a pin file that  */
index 3cc67243ffd102c71a76bad594bcc8e4ea049c68..c0fe54353e9268734891c370c9be3088b19ba051 100644 (file)
@@ -139,9 +139,9 @@ data_read(void)
            rec = (struct record *)
                &(pdb_rec->data[i * sizeof(struct record)]);
 
-           wpt_tmp->position.longitude.degrees =
+           wpt_tmp->longitude =
                (be_read32(&rec->longitude) / 1000000.0) - 180.0; 
-           wpt_tmp->position.latitude.degrees =
+           wpt_tmp->latitude =
                90.0 - (be_read32(&rec->latitude) / 1000000.0);
            wpt_tmp->shortname = xstrdup(rec->name);
 
@@ -179,9 +179,9 @@ quovadis_writewpt(waypoint *wpt)
 
     rec = xcalloc(sizeof(*rec),1);
 
-    be_write32(&rec->longitude, (wpt->position.longitude.degrees +
+    be_write32(&rec->longitude, (wpt->longitude +
                                 180.0) * 1000000.0);
-    be_write32(&rec->latitude, (90.0 - wpt->position.latitude.degrees) * 1000000.0);
+    be_write32(&rec->latitude, (90.0 - wpt->latitude) * 1000000.0);
     if ( wpt->shortname ) {
        strncpy(rec->name, wpt->shortname, 32 );
        rec->name[31] = '\0';
index 40110825e03b355bfbd04e0cd178c65ac3310e23..7d795e652c2d1c3df80c870b18f36ab22272445a 100644 (file)
@@ -148,8 +148,8 @@ my_read(void)
                               le_read32(&latlon->lon)) / (double)(0x800000);
        
                        wpt_tmp = xcalloc(sizeof (*wpt_tmp), 1);
-                       wpt_tmp->position.latitude.degrees = lat;
-                       wpt_tmp->position.longitude.degrees = -lon;
+                       wpt_tmp->latitude = lat;
+                       wpt_tmp->longitude = -lon;
                        route_add_wpt(track_head, wpt_tmp);
                } else {
                        Skip(infile, recsize);
@@ -208,8 +208,8 @@ my_read(void)
                        lon = (0x80000000UL -
                               le_read32(&latlon->lon)) / (double)(0x800000);
 
-                       wpt_tmp->position.latitude.degrees = lat;
-                       wpt_tmp->position.longitude.degrees = -lon;
+                       wpt_tmp->latitude = lat;
+                       wpt_tmp->longitude = -lon;
                        route_add_wpt(track_head, wpt_tmp);
 
                        latlon++;
index ab786d6d8c6ab70ac36319a02a8ef3e6faaab5a2..8e37e41883217c2d6faaabc5264592d848276dad 100644 (file)
@@ -142,8 +142,8 @@ data_read(void)
                                &lon, &lat, icon, desc)) {
                        wpt_tmp = xcalloc(sizeof (*wpt_tmp), 1);
 
-                       wpt_tmp->position.longitude.degrees = lon;
-                       wpt_tmp->position.latitude.degrees = lat;
+                       wpt_tmp->longitude = lon;
+                       wpt_tmp->latitude = lat;
                        wpt_tmp->description = xstrdup(desc);
                        wpt_tmp->shortname = mkshort(mkshort_handle, desc);
 
@@ -156,8 +156,8 @@ static void
 tiger_disp(const waypoint *wpt)
 {
        const char *pin;
-       double lat = wpt->position.latitude.degrees;
-       double lon = wpt->position.longitude.degrees;
+       double lat = wpt->latitude;
+       double lon = wpt->longitude;
 
        if (iconismarker)
                pin = wpt->icon_descr ? wpt->icon_descr : "";
index 1343a72d71eee64bd56f7bfcee7ce5d6410183f2..ba5d09fb31cc7119941bcbbaa1a3fe009ae42dc6 100644 (file)
@@ -118,10 +118,10 @@ data_read(void)
                        wpt_tmp->description = holder;
                    break;
                case 3:
-                   wpt_tmp->position.latitude.degrees = atof(s);
+                   wpt_tmp->latitude = atof(s);
                    break;
                case 4:
-                   wpt_tmp->position.longitude.degrees = atof(s);
+                   wpt_tmp->longitude = atof(s);
                    break;
                case 5:
                        /* ignore: NZMapGrid Easting  */
@@ -130,7 +130,7 @@ data_read(void)
                        /* ignore: NZMapGrid Northing  */
                         break;
                case 7:
-                       wpt_tmp->position.altitude.altitude_meters = atof(s);
+                       wpt_tmp->altitude = atof(s);
                    break;
                case 8:
                    /* ignore: color  */
@@ -215,9 +215,9 @@ tmpro_waypt_pr(const waypoint * wpt)
     fprintf(file_out, "new\t%.6s\t%.80s\t%08.6f\t%08.6f\t\t\t%.2f\t%d\t%d\t%.128s\n",
        shortname,
        description,
-           wpt->position.latitude.degrees,
-           wpt->position.longitude.degrees,
-           wpt->position.altitude.altitude_meters,
+           wpt->latitude,
+           wpt->longitude,
+           wpt->altitude,
            colour,
            icon,
            wpt->url
index 44bd48ea95e4026df8dd24da78326434ee3765f6..165d2809ec0b14f00a0d9a24379ff0eeaeaecc30 100644 (file)
@@ -221,12 +221,12 @@ tpg_read(void)
                lat, 
                 lon,
                 0.0,
-                &wpt_tmp->position.latitude.degrees,
-                &wpt_tmp->position.longitude.degrees,
+                &wpt_tmp->latitude,
+                &wpt_tmp->longitude,
                 &amt,
                 78);
 
-            wpt_tmp->position.altitude.altitude_meters = elev;
+            wpt_tmp->altitude = elev;
             
 
             /* 4 bytes? */
@@ -299,8 +299,8 @@ tpg_waypt_pr(const waypoint *wpt)
 
         /* convert lat/long to NAD27/CONUS datum */
         GPS_Math_WGS84_To_Known_Datum_M(
-               wpt->position.latitude.degrees,
-                wpt->position.longitude.degrees,
+               wpt->latitude,
+                wpt->longitude,
                 0.0,
                 &lat,
                 &lon,
@@ -312,7 +312,7 @@ tpg_waypt_pr(const waypoint *wpt)
         lon *= -1.0;
 
         /* convert meters back to feets */
-        elev = (short int) (wpt->position.altitude.altitude_meters * 3.2808);
+        elev = (short int) (wpt->altitude * 3.2808);
 
         /* 1 bytes stringsize for shortname */
         c = strlen(shortname);
index de96b5959394c70aa75ae0e41b74aa24bbc8a6a9..c0e7684eb54627751d887a4ba7ebb44d25aac7b9 100644 (file)
@@ -270,36 +270,36 @@ case_ignore_strcmp(const char *s1, const char *s2)
 
 }
 
-coord
+double
 mkposn(const char *string)
 {
-       coord coord = {0};
-       sscanf(string, "%lf", &coord.degrees);
+       double coord;
+       sscanf(string, "%lf", &coord);
        return coord;
 }
 
 void
-printposn(const coord *c, int is_lat)
+printposn(const float c, int is_lat)
 {
        char d;
        if (is_lat) {
-               if (c->degrees < 0) d = 'S'; else d = 'N';
+               if (c < 0) d = 'S'; else d = 'N';
        } else {
-               if (c->degrees < 0) d = 'W'; else d = 'E';
+               if (c < 0) d = 'W'; else d = 'E';
        }
-       printf("%f%c ", fabs(c->degrees), d);
+       printf("%f%c ", fabs(c), d);
 }
 
 void
-fprintdms(FILE *file, const coord *c, int is_lat)
+fprintdms(FILE *file, const double c, int is_lat)
 {
        char d;
        if (is_lat) {
-               if (c->degrees < 0) d = 'S'; else d = 'N';
+               if (c < 0) d = 'S'; else d = 'N';
        } else {
-               if (c->degrees < 0) d = 'W'; else d = 'E';
+               if (c < 0) d = 'W'; else d = 'E';
        }
-       fprintf(file, "%c%f\t", d, fabs(c->degrees));
+       fprintf(file, "%c%f\t", d, fabs(c));
 }
 
 void
index cb6e26dd59ce24eab2ec2f5f1efb13cc6e376575..b29ab9b3cb9a62eb9252c655d4bd44b171d8b606 100644 (file)
@@ -105,15 +105,15 @@ waypt_disp(const waypoint *wpt)
        if (wpt->creation_time) {
                printf("%s ", ctime(&wpt->creation_time));
        }
-       printposn(&wpt->position.latitude,1);
-       printposn(&wpt->position.longitude,0);
+       printposn(wpt->latitude,1);
+       printposn(wpt->longitude,0);
        printf("%s/%s", 
                global_opts.synthesize_shortnames ? 
                        mkshort(mkshort_handle, wpt->description) : 
                                wpt->shortname, 
                                wpt->description);
-       if (wpt->position.altitude.altitude_meters != unknown_alt)
-               printf(" %f", wpt->position.altitude.altitude_meters);
+       if (wpt->altitude != unknown_alt)
+               printf(" %f", wpt->altitude);
        printf("\n");
 }